package cn.aitrox.ry.common.dao;

import com.github.pagehelper.PageInfo;

import java.util.List;

public interface BaseDao<T> {

    String getPrimaryKey();

    T findById(Object id);

    List<T> findByIds(Object[] ids, String orderBy);

    List<T> findByCondition(T t, String orderBy);

    int findCountByCondition(T t);

    int findCount();

    List<T> findAll();

    List<T> findAllOrderBy(String orderBy);

    T findOne(T t);

    PageInfo<T> searchByCondition(Integer page, Integer pageSize, String orderBy, T t);

    PageInfo<T> search(Integer page, Integer pageSize, String orderBy);

    PageInfo<T> searchByCustom(Integer page, Integer pageSize, MapperSqlCallback<T> callback);

    PageInfo<T> searchByCustom(Integer page, Integer pageSize, String orderBy, MapperSqlCallback<T> callback);

    <K> PageInfo<K> searchResultByCustom(Integer page, Integer pageSize, MapperSqlCallback<K> callback);

    <K> PageInfo<K> searchResultByCustom(Integer page, Integer pageSize, String orderBy, MapperSqlCallback<K> callback);

    int insert(T t);

    int insertSelective(T t);

    int updateById(T t);

    int updateByIdSelective(T t);

    int updateByIds(T t, Object[] ids);

    int updateByIdsSelective(T t, Object[] ids);

    int deleteById(Object id);

    int deleteByIds(Object[] ids);

    void deleteAll();

    void batchInsert(List<T> objList, int insertCountOfIter, MapperSqlCallback<T> callback);
}
